package com.dly.blog.exception;

import com.dly.blog.content.ExceptionContent;
import lombok.Getter;

/**
 * @Author: DaiLiYu
 * @Date: 2023/7/11 21:52
 */
@Getter
public enum AuthExceptionEnum {
    LOGIN_ERROR(new AuthException(ExceptionContent.AuthException + 1, "登入失败")),
    USER_NO(new AuthException(ExceptionContent.AuthException + 2, "用户不存在")),
    JWT_EXPIRED(new AuthException(ExceptionContent.AuthException + 3, "请重新登入")),
    REFER_EXPIRED(new AuthException(ExceptionContent.AuthException + 4, "请重新登入")),
    CAPTCHA_EXPIRED(new AuthException(ExceptionContent.AuthException + 5, "验证码无效")),
    EMAIL_CAPTCHA_IS_SEND(new AuthException(ExceptionContent.AuthException + 6, "邮箱验证码发送过于频繁")),
    PASSWORD_ERROR(new AuthException(ExceptionContent.AuthException + 7, "密码错误"))
    ;


    AuthExceptionEnum(AuthException authException){
        this.authException = authException;
    }

    private final AuthException authException;


    public static class AuthException extends GlobalException{

        private static final String MODULE = "Auth";

        public AuthException(int code, String message) {
            super(code, message, MODULE);
        }
    }
}
